import {
  query as queryUsers,
  peoplelist,
  creatpeople,
  removepeople,
  peopleDetail,
  updatePeople,
  queryPeople,
  exportOperatorList,
} from '../services/people';

export default {
  namespace: 'indexe',

  state: {
    list: [],
    currentPeople: [],
  },

  effects: {
    //人员信息列表
    *getPeoplelist(_, { call, put }) {
      const response = yield call(peoplelist);
      yield put({
        type: 'saveCurrentPeople',
        payload: response,
      });
    },
  },

  reducers: {
    /*     save(state, action) {
      return {
        ...state,
        list: action.payload,
      };
    }, */
    saveCurrentPeople(state, action) {
      return {
        ...state,
        currentPeople: action.payload,
      };
    },
    changeNotifyCount(state, action) {
      return {
        ...state,
        currentPeople: {
          ...state.currentPeople,
          notifyCount: action.payload,
        },
      };
    },
  },
};
